<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<!-- jqgrid-->
<link href="${basePath}/css/plugins/jqgriddemo/css/ui.jqgrid-bootstrap.min.css" rel="stylesheet" />
<!doctype html>
<html>
<head>
	<style type="text/css">
	   *{
	      margin: 0px;
	      padding: 0px;
	      font-size: 12px;
	   }
	</style>
</head>
<body class="gray-bg">
<div class="creditbody">
    <div class="iboxtitle">
        <span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;业务受理  >业务申请 >征信反馈修改</span>
    </div>
   <div class="ibox-content ibox-zxsearchqu">
		<div class="row">
			<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
				 <div class="col-xs-12 col-sm-4 col-md-4 col-lg-2">
					 <input type="text" placeholder="客户名" id="customerName" name="customerName" class="form-control">
				</div>
				<div class="col-xs-12 col-sm-4 col-md-4 col-lg-2">
					<input type="text" placeholder="业务员" id="salesmanName" name="salesmanName" class="form-control">
				</div>
				<div class="col-xs-12 col-sm-4 col-md-4 col-lg-2">
					<button class="zhixcx" type="button" onclick="query();">执行查询</button>
				</div>	
			</div>	
		</div>	
	</div>
   
   <div class="ibox-content">
   		<span class="warning-label"><span class="red-dp-circle"></span>征信由本人查询的订单信息</span>
     	<div class="jqGrid_wrapper">
         <table id="table_list_1"></table>
         <div id="pager_list_1"></div>
    	</div>
   </div>
   
   <div style="display: none;" id="zxfk">
   	<div class="padding-nono">
		  <table class="selectcheck ">
	           <tr>  
		            <td><label class="control-label np">开卡状态：</label></td>  
		            <td>  
		                <label><input type="checkbox" value="01" name="once_car_status" checked="checked" disabled="disabled"/>均无</label>  
		                <label><input type="checkbox" value="02" name="once_car_status" disabled="disabled"/>曾有灰名单</label>  
		                <label><input type="checkbox" value="03" name="once_car_status" disabled="disabled"/>现有灰名单</label>  
		                <label><input type="checkbox" value="04" name="once_car_status" disabled="disabled"/>外部欺诈客户</label>
		                <label><input type="checkbox" value="05" name="once_car_status" disabled="disabled"/>交叉违约</lable>  
		            </td>  
	        	</tr>  
         </table>	
         <table class="selectcheck clear-both">
          	<tr>
          		<td align="right">
					<label class="control-label np">征信状态：</label>
				</td>
				<td>
					<label><input type="radio" name="credit_result" value="01" checked="checked" disabled="disabled">正常</label>
					<label><input type="radio" name="credit_result" value="02" disabled="disabled">关注</label>
					<label><input type="radio" name="credit_result" value="03" disabled="disabled">禁入</label>
				</td>
          	</tr>
         </table>	
        
        	<ul class="zxsearch-ulc clear-both">
            	<li class="zxsearch-ulli">信息备注：</li>
            	<li class="zxsearch-ullib">
					<textarea class="form-control select-control-tebie" id="gcr_remarks" rows="4" name="gcr_remarks" ></textarea>
				</li>
            </ul>
        </div>
        <div class="padding-nono">
	        <table cellpadding="0" cellspacing="0" border="0" bordercolor="#3B95C8"  width="100%">
				<tr>
					<td width="100%" align="center">
						 <div class="ibox-content">
				              <button type="button" class="btn dpbtn_green " onclick="baocun();">确定</button>
				          </div>
					</td>
				</tr>
			</table>
   	 </div>
   </div>

	<!-- public quote -->
    <%@include file="/jsp/comm_js_include.jsp"%>

	<!-- jqGrid -->
    <script type="text/javascript" charset="utf-8" src="${basePath}/js/plugins/jqgriddemo/js/jquery.jqGrid.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${basePath}/js/plugins/jqgriddemo/js/grid.locale-cn.min.js"></script>

	<!-- summernote -->
 	<%@include file="/js/common-dpqc/dpqc-summernote/comm_summernote_include.jsp"%>

	<script type="text/javascript">

	var winWidth = $(window).width();
	var winHeight = $(window).height();
	
	var replaceId = "";
	var openIndex = 0;

	jQuery(function($){
		getData();
	});

	var bclayer;
    var getData = function()
    {	
    	var winWidth = $('div.ibox-content').width();
    	var winHeight = document.body.offsetHeight - 360;
    	var win = winWidth / 7 - 10;
	 	$.jgrid.defaults.styleUI = 'Bootstrap';
	    jQuery("#table_list_1").jqGrid({
		url:'${basePath}/YwShenQingZxController/getList?examineStatus=M_zxfk',
        datatype : "json",
        colNames : [ 'replaceId','tid','hid', '业务提交时间','部门','业务员','客户姓名','角色', '身份证号码', '银行'],
        colModel : [
                     {name: 'replaceId', index: 'id', hidden:true},
                     {name: 'tid', index: 'tid', hidden:true},
                     {name: 'hid', index: 'hid', hidden:true},
                     {name: 'created',index: 'created',width: win,align: "center",sortable: false},
                     {name: 'name',index: 'created',width: win,align: "center",sortable: false},
                     {name: 'creatorName',index: 'created',width: win,align: "center",sortable: false},
                     {name: 'cusName',index: 'created',width: win,align: "center",sortable: false},
                     {name: 'creditPeopleType',index: 'created',width: win,align: "center",sortable: false,
                    	 formatter: function (cellvalue, options, rowObject) 
                    	 {
                    		 if(cellvalue == "01")
                    		 {
                    			 return "配偶";
                    		 }
                    		 
                    		 if(cellvalue == "02")
                    		 {
                    			 return "担保人";
                    		 }
                    		 
                    		 if(cellvalue == "03")
                    		 {
                    			 return "主借人";
                    		 }
                    	 }	 
                     },
                     {name: 'cusNo',index: 'created',width: win,align: "center",sortable: false},
            		 {name: 'bankCode',index: 'created',width: win,align: "center",sortable: false}
                   ],
          mtype : "post",
          height: winHeight,
          width:winWidth,  
          autowidth: false,
          shrinkToFit: false,
          rowNum: 15,
          rowList: [15, 30, 45],
          viewrecords: true,
          pager: "#pager_list_1",
          hidegrid: false,
          multiselect : false,
          altRows:true,
          altclass:'someClass',
          ondblClickRow:function(rowId)
          {
        	  //页面层
        	  openIndex = layer.open({
	        	    type: 1,
	        	    area: ['60%', '50%'], //宽高
	        	    content: $('#zxfk')
        	  });
        	  
        	  //结果集
        	  var row = $("#table_list_1").jqGrid("getRowData",rowId);
        	  replaceId = row.replaceId;
        	  
        	  //查询征信结果表的数据
        	  $.dpAjax({
			   		url:'${basePath}/YwShenQingZxController/getZhengXinFanKuiResult',
			   		data:{
			   			"replaceId":replaceId
			   		},
					success: function(datas){
				 	  if(datas.flag == "100100")
				 	  {
				 		  layer.msg("查询成功!", {icon: 6, time: 1000});
				 		  
				 		  var result = datas.result;
				 		  
				 		  if(result && null != result)
				 		  {
				 			  for(var i=0;i<result.length;i++)
				 			  {
				 				  var d = result[i];
				 				  var credit_result_mark = d['credit_result_mark'];
				 				  if(credit_result_mark && null != credit_result_mark)
				 				  {
				 					  $('#gcr_remarks').val(credit_result_mark);
				 				  }
				 				  
				 				  var credit_result = d['credit_result'];
				 				  if(credit_result && null != credit_result)
				 				  {
				 					  var objs = document.getElementsByName("credit_result");
				 					  for(var x=0;x<objs.length;x++)
				 					  {
				 						  //alert(objs[x].value + '-' + credit_result);
				 						  if(objs[x].value ==  credit_result)
				 						  {
				 							 objs[x].checked = true;
				 							 break;
				 						  }
				 					  }
				 				  }
				 				  var once_car_status = d['once_car_status'];
				 				  if(once_car_status && null != once_car_status)
				 				  {
				 					  var objs = once_car_status.split(",");
				 					  var pp = document.getElementsByName("once_car_status");
				 					  
				 					  if(objs.length < 1)
				 					  {
				 						 return;
				 					  }
				 					  if(objs.length > 0)
				 					  {
				 						 pp[0].checked = false;
				 					  }
				 					  for(var x=0;x<objs.length;x++)
				 					  {
				 						  for(var j=0;j<pp.length;j++)
				 						  {
				 							 if(objs[x] == pp[j].value)
				 							 {
				 								pp[j].checked = true;
				 								break;
				 							 }
				 						  }
				 					  }
				 				  }
				 			  }
				 		  }
				 		  
						  return;
					  }
					  if(datas.flag == "100200")
					  {
						  alert(JSON.stringify(datas));
			              return;
			          }
					  layer.msg(datas.message, {icon: 2});
					}
			  });
				
          },
          jsonReader : {
        	  root:"result.rows",
        	  page: "result.page",
        	  total: "result.total",
        	  records: "result.records",
        	  repeatitems: false,
        	  id: "replaceId"
          },
          loadComplete:function(datas){
         	  if (datas.flag == "100100") {
                   layer.msg("查询成功!", {icon: 6, time: 1000});
                   return;
               }
         	 if(datas.flag == '100802') {
				  top.location.href = thisLoginUrl;
				  return;
			  }

         	  layer.msg(datas.message, {icon: 2});
           }
      });
    }

    window.onresize = function()
    {
    	$("#table_list_1").setGridWidth($(window).width()-80);
    }

    var refresh = function()
    {
    	$("#table_list_1").jqGrid("setGridParam", { search: true }).trigger("reloadGrid", []);
    }
    
    
    //查询
    var query = function()
    {
    	var postData = $("#table_list_1").jqGrid("getGridParam", "postData");
    	var customerName = document.getElementById('customerName').value || '';
    	var salesmanName = document.getElementById('salesmanName').value || '';
    	$.extend(postData,{"cus_name":customerName.trim(),"creator_name":salesmanName});
    	refresh();
    }
    
    //保存
    var baocun = function()
    {
    	//询问框
		layer.confirm('征信反馈信息，是否确认本次操作？操作人：<span style="color:#BD1723;">${current_user_key.uname}</span>', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			layer.closeAll();
			var credit_result_mark = $("#gcr_remarks").val();
			$.dpAjax({
		   		url:'${basePath}/YwShenQingZxController/updateZhengXinFanKuiResult',
		   		data:{
		   			"replaceId":replaceId,
		   			"credit_result_mark":credit_result_mark
		   		},
				success: function(datas){
			 	  if(datas.flag == "100100")
			 	  {
			 		  layer.msg("征信反馈修改执行成功！", {icon: 6});
			 		  setTimeout(function () {
			 			 layer.close(openIndex);
			 		  }, 1000);
					  return;
				  }
				  if(datas.flag == "100200")
				  {
					  alert(JSON.stringify(datas));
		              return;
		          }
				  layer.msg(datas.message, {icon: 2});
				}
		   	});
			
		}, function(){
			layer.msg("已取消本次操作！", {icon: 6});
		});
    }
</script>
</body>
</html>
